[Unit]
Description=Etcd Server
After=network.target
After=network-online.target
Wants=network-online.target

[Service]
Type=notify
WorkingDirectory={{ etcd_data_dir | default('/var/lib/etcd') }}
EnvironmentFile=-{{ etcd_conf_dir | default('/etc/etcd') }}/etcd.conf
User=etcd
# set GOMAXPROCS to number of processors
ExecStart=/bin/bash -c "GOMAXPROCS=$(nproc) /usr/local/bin/etcd"
Restart=on-failure
RestartSec=10
StartLimitInterval=0
TimeoutStartSec=180
LimitNOFILE=65536

{% if ansible_virtualization_type not in ['container', 'docker', 'lxc', 'podman'] %}
IOSchedulingClass=realtime
IOSchedulingPriority=0
Nice=-20
{% endif %}

[Install]
WantedBy=multi-user.target
